<div class="col col-sm-offset-3">
  <div class="alert alert-info">
    <small
      >* For hosts, paths, methods and protocols, snis, sources, headers and destinations
      press enter to apply every value you type</small
    >
  </div>
</div>
<div class="form-group" ng-class="{'has-error' : errors.name}">
  <label class="col-sm-3 control-label"
    >Name <br /><em><small class="help-block">optional</small></em></label
  >
  <div class="col-sm-9">
    <input ng-model="route.name" class="form-control" />
    <div
      class="text-danger"
      ng-if="errors.name"
      data-ng-bind="errors.name"
    ></div>
    <p class="help-block">
      The name of the Route.
    </p>
  </div>
</div>
<div class="form-group" ng-if="isGatewayVersionEqOrGreater('1.1.0-rc1')">
  <label class="col-sm-3 control-label"
    >Tags <br /><em><small class="help-block">optional</small></em></label
  >
  <div class="col-sm-9">
    <chips ng-model="route.tags">
      <chip-tmpl>
        <div class="default-chip">
          {{chip}}
          <i class="mdi mdi-close" remove-chip></i>
        </div>
      </chip-tmpl>
      <input
        ng-model-control
        data-ng-keypress="onTagInputKeyPress($event)"
        ng-model="$tag"
        uib-typeahead="tag for tag in tags | filter:$viewValue | limitTo:10"
      />
    </chips>
    <p class="help-block">
      Optionally add tags to the route
    </p>
  </div>
</div>
<div class="form-group" ng-class="{'has-error' : errors.hosts}">
  <label class="col-sm-3 control-label"
    >Hosts <br /><em><small class="help-block">semi-optional</small></em></label
  >
  <div class="col-sm-9">
    <chips ng-model="route.hosts">
      <chip-tmpl>
        <div class="default-chip">
          {{chip}}
          <i class="mdi mdi-close" remove-chip></i>
        </div>
      </chip-tmpl>
      <input chip-control />
    </chips>
    <!--<input ng-model="route.hosts" class="form-control">-->
    <div
      class="text-danger"
      ng-if="errors.hosts"
      data-ng-bind="errors.hosts"
    ></div>
    <p class="help-block">
      A list of domain names that match this Route. For example: example.com. At
      least one of hosts, paths, or methods must be set.
    </p>
  </div>
</div>
<div class="form-group" ng-class="{'has-error' : errors.paths}">
  <label class="col-sm-3 control-label"
    >Paths <br /><em><small class="help-block">semi-optional</small></em></label
  >
  <div class="col-sm-9">
    <chips ng-model="route.paths">
      <chip-tmpl>
        <div class="default-chip">
          {{chip}}
          <i class="mdi mdi-close" remove-chip></i>
        </div>
      </chip-tmpl>
      <input chip-control />
    </chips>
    <p class="help-block">
      A list of paths that match this Route. For example: /my-path. At least one
      of <code>hosts</code>, <code>paths</code>, or <code>methods</code> must be
      set.
    </p>
  </div>
</div>
<div class="form-group" ng-class="{'has-error' : errors.headers}">
  <label class="col-sm-3 control-label"
    >Headers <br /><em
      ><small class="help-block">semi-optional</small></em
    ></label
  >
  <div class="col-sm-9">
    <chips ng-model="route.headers">
      <chip-tmpl>
        <div class="default-chip">
          {{chip}}
          <i class="mdi mdi-close" remove-chip></i>
        </div>
      </chip-tmpl>
      <input chip-control />
    </chips>
    <p class="help-block">
      One or more lists of values indexed by header name that will cause this
      Route to match if present in the request. The <code>Host</code> header cannot be used
      with this attribute: hosts should be specified using the <code>hosts</code> attribute.<br>
      <code>Field values format example: x-some-header:foo,bar</code>
    </p>
  </div>
</div>
<div
  class="form-group"
  ng-class="{'has-error' : errors.https_redirect_status_code}"
>
  <label class="col-sm-3 control-label"
    >Https redirect status code <br /><em
      ><small class="help-block">optional</small></em
    ></label
  >
  <div class="col-sm-9">
    <input
      type="number"
      class="form-control"
      ng-model="route.https_redirect_status_code"
    />
    <p class="help-block">
      The status code Kong responds with when all properties of a Route match
      except the protocol, i.e. if the protocol of the request is
      <code>HTTP</code> instead of <code>HTTPS</code>.
      <code>Location</code> header is injected by Kong if the field is set to
      301, 302, 307 or 308. Defaults to <code>426</code>.
    </p>
  </div>
</div>
<div class="form-group" ng-class="{'has-error' : errors.regex_priority}">
  <label class="col-sm-3 control-label"
    >Regex priority <br /><em
      ><small class="help-block">optional</small></em
    ></label
  >
  <div class="col-sm-9">
    <input type="number" class="form-control" ng-model="route.regex_priority" />
    <p class="help-block">
      A number used to choose which route resolves a given request when several
      routes match it using regexes simultaneously. When two routes match the
      path and have the same <code>regex_priority</code>, the older one (lowest
      <code>created_at</code>) is used. Note that the priority for non-regex
      routes is different (longer non-regex routes are matched before shorter
      ones). Defaults to <code>0</code>.
    </p>
  </div>
</div>
<div class="form-group" ng-class="{'has-error' : errors.methods}">
  <label class="col-sm-3 control-label"
    >Methods <br /><em
      ><small class="help-block">semi-optional</small></em
    ></label
  >
  <div class="col-sm-9">
    <chips ng-model="route.methods">
      <chip-tmpl>
        <div class="default-chip">
          {{chip}}
          <i class="mdi mdi-close" remove-chip></i>
        </div>
      </chip-tmpl>
      <input chip-control />
    </chips>
    <p class="help-block">
      A list of HTTP methods that match this Route. At least one of
      <code>hosts</code>, <code>paths</code>, or <code>methods</code> must be
      set.
    </p>
  </div>
</div>
<div class="form-group">
  <label class="col-sm-3 control-label"
    >Strip Path <br /><em><small class="help-block">optional</small></em></label
  >
  <div class="col-sm-9">
    <input
      bs-switch
      ng-model="route.strip_path"
      switch-size="small"
      type="checkbox"
      switch-on-text="YES"
      switch-off-text="NO"
    />
    <p class="help-block">
      When matching a Route via one of the <code>paths</code>, strip the
      matching prefix from the upstream request URL.
    </p>
  </div>
</div>
<div class="form-group">
  <label class="col-sm-3 control-label"
    >Preserve Host <br /><em
      ><small class="help-block">optional</small></em
    ></label
  >
  <div class="col-sm-9">
    <input
      bs-switch
      ng-model="route.preserve_host"
      switch-size="small"
      type="checkbox"
      switch-on-text="YES"
      switch-off-text="NO"
    />
    <p class="help-block">
      When matching a Route via one of the <code>hosts</code> domain names, use
      the request <code>Host</code> header in the upstream request headers. By
      default set to <code>false</code>, and the upstream Host header will be
      that of the Service's <code>host</code>
    </p>
  </div>
</div>
<div class="form-group" ng-class="{'has-error' : errors.protocols}">
  <label class="col-sm-3 control-label"
    >Protocols <br /><em
      ><small class="help-block">semi-optional</small></em
    ></label
  >
  <div class="col-sm-9">
    <chips ng-model="route.protocols">
      <chip-tmpl>
        <div class="default-chip">
          {{chip}}
          <i class="mdi mdi-close" remove-chip></i>
        </div>
      </chip-tmpl>
      <input chip-control />
    </chips>
    <p class="help-block">
      A list of the protocols this Route should allow. By default it is
      <code>["http", "https"]</code>, which means that the Route accepts both.
      When set to <code>["https"]</code>, HTTP requests are answered with a
      request to upgrade to HTTPS.
    </p>
  </div>
</div>

<div class="form-group" ng-class="{'has-error' : errors.snis}">
  <label class="col-sm-3 control-label"
    >SNIs <br /><em><small class="help-block">semi-optional</small></em></label
  >
  <div class="col-sm-9">
    <chips ng-model="route.snis">
      <chip-tmpl>
        <div class="default-chip">
          {{chip}}
          <i class="mdi mdi-close" remove-chip></i>
        </div>
      </chip-tmpl>
      <input chip-control />
    </chips>
    <p class="help-block">
      A list of SNIs that match this Route when using stream routing. When using
      <code>tcp</code> or <code>tls</code> protocols, at least one of
      <code>snis</code>, <code>sources</code>, or <code>destinations</code> must
      be set.
    </p>
  </div>
</div>
<div class="form-group" ng-class="{'has-error' : errors.sources}">
  <label class="col-sm-3 control-label"
    >Sources <br /><em
      ><small class="help-block">semi-optional</small></em
    ></label
  >
  <div class="col-sm-9">
    <chips ng-model="route.sources">
      <chip-tmpl>
        <div class="default-chip">
          {{chip}}
          <i class="mdi mdi-close" remove-chip></i>
        </div>
      </chip-tmpl>
      <input chip-control />
    </chips>
    <p class="help-block">
      A list of IP sources of incoming connections that match this Route when
      using stream routing. Each entry is an object with fields “ip” (optionally
      in CIDR range notation) and/or “port”. When using <code>tcp</code> or
      <code>tls</code> protocols, at least one of <code>snis</code>,
      <code>sources</code>, or <code>destinations</code> must be set.
      <br />
      <code
        >The field expects values with ip:port format. ex:
        192.168.1.2:3000</code
      >
    </p>
  </div>
</div>
<div class="form-group" ng-class="{'has-error' : errors.destinations}">
  <label class="col-sm-3 control-label"
    >Destinations <br /><em
      ><small class="help-block">semi-optional</small></em
    ></label
  >
  <div class="col-sm-9">
    <chips ng-model="route.destinations">
      <chip-tmpl>
        <div class="default-chip">
          {{chip}}
          <i class="mdi mdi-close" remove-chip></i>
        </div>
      </chip-tmpl>
      <input chip-control />
    </chips>
    <p class="help-block">
      A list of IP destinations of incoming connections that match this Route
      when using stream routing. Each entry is an object with fields “ip”
      (optionally in CIDR range notation) and/or “port”. When using
      <code>tcp</code> or <code>tls</code> protocols, at least one of
      <code>snis</code>, <code>sources</code>, or <code>destinations</code> must
      be set.
      <br />
      <code
        >The field expects values with ip:port format. ex:
        192.168.1.2:3000</code
      >
    </p>
  </div>
</div>
